package com.galeno.day07;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.state.FunctionInitializationContext;
import org.apache.flink.runtime.state.FunctionSnapshotContext;
import org.apache.flink.streaming.api.checkpoint.CheckpointedFunction;
import org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction;

/**
 * @author galeno
 * @Title:
 * @Description: 在SOurce中定义OperatorState, 不跟key绑定在一起的
 * <p>
 * OperatorState只有一种形式  就是ListState
 * 若想使用 必须实现checkpointedFunction接口
 * @date 2021/10/2315:04
 */
public class MyAtLeatFileSource extends RichParallelSourceFunction implements CheckpointedFunction {
    public MyAtLeatFileSource(){

    }
    @Override
    public void open(Configuration parameters) throws Exception {
        System.out.println("open");

    }

    @Override
    public void run(SourceContext ctx) throws Exception {

        System.out.println("run");

    }

    @Override
    public void cancel() {

    }

    @Override
    public void close() throws Exception {

    }

    @Override
    public void snapshotState(FunctionSnapshotContext context) throws Exception {

    }

    @Override
    public void initializeState(FunctionInitializationContext context) throws Exception {

    }
}
